import { defineStore } from "pinia";

export const useCountStore = defineStore('count', {

    //actions 里面放的是一个一个的方法，用于响应组件中的动作
    actions: {
        increment(value: number) {
            this.sum += value;
        }
    },

    //真正存储数据的地方
    state() {
        return {
            sum: 5,
            school: 'guigu',
            address: 'address'
        }
    },
    getters: {
        bigSum(state) {
            return state.sum * 10;
        }

        //箭头函数写法  效果同上
        // bigSum: state => state.sum * 10
    }
});